
package deeloco.android.meteoclimatic.donate.datos;

import deeloco.android.meteoclimatic.donate.datosEstacion;
import deeloco.android.meteoclimatic.donate.prevision;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class ViewPagerAdapter extends FragmentPagerAdapter
{

    private String[] locations;
    private Bundle extras;

    public ViewPagerAdapter(FragmentManager fm, String[] locations, Bundle extras) 
    {
        super(fm);
        this.locations = locations;
        this.extras=extras;
    }

    public int getCount() 
    {
        return locations.length;
    }

    public Fragment getItem(int position) 
    {
    	Fragment fragment=null;
    	Bundle bundle;
    	
    	switch (position) 
    	{
			case 0:
			fragment = new datosEstacion();
			bundle = new Bundle();
			bundle.putString("codigo", extras.getString("codigo"));
			bundle.putString("nombre", extras.getString("nombre"));
			bundle.putBoolean("estado", extras.getBoolean("estado"));
			bundle.putString("desEstado", extras.getString("desEstado"));
			fragment.setArguments(bundle);
			break;
			
			case 1:
			fragment = new prevision();
			break;
		}
        return fragment;

    }

}
